package b3.widget.home.town
{
	import b3.net.*;
	import b3.util.*;
	import b3.widget.basic.*;
	
	import flash.display.*;
	import flash.filters.*;
	import flash.text.*;

	public class RentCountDownPane extends BasicWidget
	{
		private var textField:TextField;
		
		public function RentCountDownPane()
		{
			super();
			this.effect = BasicWidget.EFFECT_FLOAT;
			//文字
			textField = new TextField();
			textField.selectable = false;
        	textField.autoSize = TextFieldAutoSize.LEFT;
			textField.defaultTextFormat = new TextFormat(BFont.fontName, 12, 0x00AA00, true);
			textField.filters = [new GlowFilter(0xFFFFFF, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			addChild(textField);
			this.mouseChildren = false;
			this.mouseEnabled = false;
		}
		
		public function updateRemainTime(remainTime:int, text:String):void
		{
			var seconds:int = remainTime % 60;
			remainTime /= 60;
			var minutes:int = remainTime % 60;
			remainTime /= 60; 
			var honours:int = remainTime % 60;
			textField.text = (honours > 0 ? ((honours < 10 ? "0" : "") + honours + ":") : "") +  
				(minutes < 10 ? "0" : "") + minutes + ":" + 
				(seconds < 10 ? "0" : "") + seconds + text;  
		}
		
	}
}